class Student(object):
    def __init__(self,name):
        self.name = name

    def __str__(self):
        return 'Student object (name: %s)' % self.name
    __repr__ = __str__

    def __getattr__(self, item):
        if item == 'score':
            return lambda: 99
    def __call__(self):
        print('My name is %s.' % self.name)

class Fib(object):
    def __init__(self):
        self.a, self.b = 0, 1

    def __iter__(self):
        return self

    def next(self):
        self.a, self.b = self.b, self.a + self.b
        if self.a > 10000:
            raise StopIteration();
        return self.a
    def __getitem__(self, item):
        if isinstance(item,int):
            a, b = 1, 1
            for x in range(item):
                a, b = b, a + b
            return a
        if isinstance(item,slice):
            start = item.start
            stop = item.stop
            a, b = 1, 1
            L = []
            for x in range(stop):
                if x >= start:
                    L.append(a)
                a, b = b, a + b
            return L

    def __getattr__(self, attr):
        if attr=='score':
            return 99

s = Student('LiYan')
s()
print callable(Student('LiYan'))
